package com.idmiss.qdpz.dal.mysql.article;

import com.idmiss.qdpz.common.mapper.BaseMapperX;
import com.idmiss.qdpz.common.mapper.LambdaQueryWrapperX;
import com.idmiss.qdpz.common.page.PageResult;
import com.idmiss.qdpz.controller.admin.article.vo.ArticlePageReqVO;
import com.idmiss.qdpz.dal.dataobject.article.ArticleDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 资讯 Mapper
 *
 * @author idmiss
 */
@Mapper
public interface ArticleMapper extends BaseMapperX<ArticleDO> {

    default PageResult<ArticleDO> selectPage(ArticlePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ArticleDO>()
                .eq(reqVO.getType() != null, ArticleDO::getType, reqVO.getType())
                .orderByDesc(ArticleDO::getId));
    }

}
